dataComet supports AppleScript commands which allow the user to control dataComet through scripts. All dataComet macro functions are accessible through the "execute" event, which submits a macro string to dataComet for execution by the frontmost window.
Currently AppleScript recording is not supported by dataComet. You can, however, record a dataComet macro using "Record macro..." and then use the results in an execute command. Note that '\' characters in the macro commands must be doubled ("\\") in order to prevent your AppleScript Script Editor application from interpreting them as special characters.
As of the 4.43B4 version, some limitations apply on the use of the "copy" and "paste" commands in AppleScript when dataComet is in the background. A sample script appears below to show how to use the copy and paste commands when controlling dataComet while it is in the background.
The AppleScript dataComet "copy" command now waits for up to 45 seconds for dataComet macros executing in the frontmost session to be completed before copying the window selection to try to guarantee that select/copy macro scripts will work smoothly. NOTE that during this wait all applications on your Macintosh will have to wait for the loop to complete; if you're using a complicated macro to display and select text, it's best to check whether the "status" of a session contains "Executing" before performing a copy; this way you can be absolutely certain that complex selection macros will copy the selection you really want.
More sample script snippets which might be useful...
The status inquiry returns a string containing a list of tab-delimited strings which can help in monitoring the status of the frontmost session. The string may contain the following names and status indications: "WindowName LineCount CharCount SessionType TermType NewData ConnectionStatus 3270Status MacroStatus". You can use the MacroStatus returned by the "status" call to synchronize scripts by using a '!Z' or '!z' macro at the end of an "execute" call to guarantee that the host has sent an indication that its output is complete (this is application-dependent, since you must rely how the host application draws its screens).
E.g., you might receive the following status reports: